<?php

namespace app\meizhuangapi\controller\sharp;


use app\meizhuangapi\service\sharp\Active as ActiveService;
use app\api\controller\sharp\Index as IndexModel;

/**
 * 整点秒杀-秒杀首页
 * Class index
 * @package app\api\controller\sharp
 */
class Index extends IndexModel
{
    /**
     * 秒杀活动首页
     */
    public function index(){
        $service = new ActiveService;
        $active_time_id=input('post.active_time_id');
        $data = $service->getHallIndex();
        $data['titleImageUrl']="https://box.ldtckj.com/20201211113235ec2cd6828.png";
        if (empty($data['tabbar'])) {
            return $this->renderError('很抱歉，暂无秒杀活动');
        }
        if($active_time_id){
            $tabbar=$data['tabbar'];
            $goodsList = $service->getGoodsListByActiveTimeId($active_time_id);
            return $this->renderSuccess(compact('goodsList','tabbar'));
        }else{
            return $this->renderSuccess($data);
        }
    }
}